import time
from selenium import webdriver

# 添加代理
# options = webdriver.ChromeOptions()  # 创建一个配置对象
# options.add_argument('--proxy-server=http://221.229.212.171:25091')  # 使用代理ip
# driver = webdriver.Chrome(options=options)  # 实例化带有配置的driver对象
# driver.get('https://read.douban.com/category/1?sort=sales&page=1')
# time.sleep(3)
# print(driver.page_source)
# input()


driver = webdriver.Chrome()
driver.get('https://www.baidu.com')
# 添加cookie
driver.add_cookie({'name':'key','value':'value'})
time.sleep(10)
# 输入动作
driver.find_element("xpath","//input[@id='kw']").send_keys('python')
time.sleep(10)
# 点击动作
driver.find_element("xpath","//input[@id='su']").click()
time.sleep(10)
# 下滑动作
driver.execute_script('window.scrollTo(0,document.body.scrollHeight)')
input()


